/********************************************************************
	TABAL ENGINE - 2012/11/04
	author:		Marc Cuscullola
	
	purpose:	Manages the effects and the techniques
*********************************************************************/
#pragma once

#ifndef __GRAPHICS__EFFECT_MANAGER__INCLUDED_H__
#define __GRAPHICS__EFFECT_MANAGER__INCLUDED_H__

#include "Maps\MapManager.h"
#include "Effect.h"
#include "EffectTechnique.h"
#include "Textures\Texture.h"
#include "Matrix\Matrix44.h"
#include <string>
#include <queue>

class CEffectManager
{
public:
	CEffectManager();
	~CEffectManager();

	bool	Load	(const std::string& _sFilename);
	bool	Reload	();
	void	CleanUp	();

	CEffect*			GetEffect		(const std::string& _sName);
	CEffectTechnique*	GetTechnique	(const std::string& _sName);

	void	SetCamera (const Mat44f& _view, const Mat44f& _projection);

	inline const Mat44f&	GetWorldMatrix() const;
	inline const Mat44f&	GetViewMatrix() const;
	inline const Mat44f&	GetProjectionMatrix() const;
	inline const Mat44f&	GetOrthographicMatrix() const;
	inline const Mat44f&	GetViewProjectionMatrix() const;
	inline const Mat44f&	Get2DViewMatrix() const;
	inline CTexture*		GetTexture();

	inline void				SetWorldMatrix(const Mat44f& _mat);
	inline void				SetOrthoMatrix(const Mat44f& _mat);
	inline void				Set2DViewMatrix(const Mat44f& _mat);
	inline void				PushTexture(CTexture* _pTexture);

private:
	bool	LoadFile();

private:
	std::string		m_sFilename;

	CMapManager<CEffect>			m_EffectMap;
	CMapManager<CEffectTechnique>	m_EffectTechniqueMap;

	std::queue<CTexture*>	m_TextureQueue;
	Mat44f		m_WorldMatrix, m_ViewMatrix, m_ProjectionMatrix, m_OrthographicMatrix;
	Mat44f		m_2DViewMatrix;
	Mat44f		m_ViewProjectionMatrix;
};

#include "EffectManager.inl"

#endif //__GRAPHICS__EFFECT_MANAGER__INCLUDED_H__